<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core">
    <ui:composition template="templateadmin.xhtml">

        <ui:define name="content">
            <script type="text/javascript">
            function show_confirm(){
                 var r=confirm("Are your sure update information!");
                     if (r==true){
                           alert("information has been changed");
                         }
                      else {
                            alert(" stoped change!");
                            }
                }


            </script>
            <center>
                <h1>Management Car Detail</h1>
                <br/>
                <h:form id="model" onsubmit="return formValidator()" >
                    <b><a href="newcardetail.xhtml?pageID1=1" style="color: red">Create Car Detail</a></b>
                    <table border="0" cellpadding="0" cellspacing="0" id="product-table">
                        <tr>

                            <th class="table-header-repeat line-left minwidth-1" width="70px"><a href="">Model Name</a></th>
                            <th class="table-header-repeat line-left minwidth-1" width="50px"><a href="">Car Name</a></th>
                            <th class="table-header-repeat line-left minwidth-1" width="80px"><a href="">Description</a></th>
                            <th class="table-header-repeat line-left minwidth-1" width="30px"><a href="">Capacity</a></th>
                            <th class="table-header-repeat line-left minwidth-1" width="100px"><a href="">Images</a></th>
                            <th class="table-header-repeat line-left minwidth-1" width="40px"><a href="">Price</a></th>
                            <th class="table-header-repeat line-left minwidth-1" width="60px"><a href="">Option</a></th>
                        </tr>
                        <ui:repeat value="#{carDetailBean.lcar}" var="lcar">
                            <tr>
                                <td> <h:selectOneMenu value="#{lcar.modelID}" styleClass="styledselect_form_1">
                                        <f:selectItems value="#{carDetailBean.lmodel}" var="lm" itemLabel="#{lm.modelName}" itemValue="#{lm.modelID}"></f:selectItems>
                                    </h:selectOneMenu></td>

                                <td><h:inputText value="#{lcar.carName}"  id="txtnamec" styleClass="inp-form12" required="true" requiredMessage="please input name"></h:inputText>
                                    <h:message for="txtnamec" styleClass="error-inner"></h:message>
                                </td>

                                <td><h:inputText value="#{lcar.description}" styleClass="inp-form12" id="txtde" required="true" requiredMessage="please input desciption"></h:inputText>
                                    <h:message for="txtde" styleClass="error-inner"> </h:message>
                                </td>

                                <td><h:inputText value="#{lcar.capacity}"  id="txtcapacity" styleClass="inp-form12" required="true" requiredMessage="please input capacity: integer"></h:inputText>
                                    <h:message for="txtcapacity" styleClass="error-inner"> </h:message>
                                </td>
                                <td><img src="#{lcar.images}" width="80" height="80" alt=""></img></td>
                                <td><h:inputText value="#{lcar.price}" id="txtprice" styleClass="inp-form12"  required="true" requiredMessage="please input price : float"> </h:inputText></td>
                                <td><h:commandButton action="#{carDetailBean.updateCarDetail(lcar)}" onclick="show_confirm()" styleClass="form-update"></h:commandButton></td>
                            </tr>
                        </ui:repeat>
                    </table>
                    Page : <ui:repeat value="#{carDetailBean.pageList}" var="page1">
                        <a href="managercardetail.xhtml?pageID1=#{page1}">#{page1}</a>-
                    </ui:repeat>

                </h:form>
            </center>
        </ui:define>
    </ui:composition>
</html>



